home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4156 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: sn.no!usenet
  2. From: Jakob Rivertz <orjarive@aftenposten.no>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: New C Programmer Has A Problem
  5. Date: 2 Feb 1996 09:17:44 GMT
  6. Organization: Aftenposten A/S
  7. Message-ID: <4eskro$m27@hasle.sn.no>
  8. References: <4EHPA3$6KL@NNTP.NOVIA.NET> <310fa7d2.6059545@wvnvm.wvnet.edu>
  9. NNTP-Posting-Host: gatekeeper.aftenposten.no
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.2N (Windows; I; 16bit)
  14.  
  15. u6ed4@wvnvm.wvnet.edu (bonni mierzejewska) wrote:
  16. >On 29 Jan 1996 06:26:10 GMT, tsyslo@oasis.novia.net (Tony Syslo) wrote:
  17. >
  18. >>  #include <clib/dos_protos.h>
  19. >>  #include <dos/dos.h>
  20. >>  #include <stdio.h>
  21. >>  #include <exec/types.h>
  22. >
  23. >Hmm.  If you're in MS-DOS, those '/' slashes need to be '\' slashes.
  24.  
  25. It's AmigaDOS; which does use '/' characters to separate directories.
  26.  
  27. BTW: MS/DOS as such can use '/' characters to separate directories. No
  28. MS/DOS *commands* use it though, because it would conflict with the
  29. command line option character. Try "fopen("c:/config.sys", "r");" on an
  30. MS/DOS compiler. It works.
  31.  
  32. I did read the original post, and some of the responses. I think the
  33. actual problem with the code has been covered, and will only make a few
  34. general comments:
  35.  
  36. The Open, Close, Read, Write, Seek, and Exit functions are part of the
  37. dos.library library (a DLL-like library). Open returns a BPTR to a
  38. (struct FileHandle). It is typedef'ed in dos/dos.h. A BPTR is a BCPL-type
  39. pointer to some data object. A BPTR operates on long-word boundary, ie.
  40. BPTR = CPTR >> 2. Never mind, BPTRs are only used internally by the
  41. dos.library.
  42.  
  43. *Newer* use the Exit() function to terminate a program that has been
  44. linked with the standard C startup code. Exit() terminates your process
  45. imediately, preventing the startup code from closing stdin/stdout,
  46. freeing dynamically allocated memory, etc. Always use exit().
  47.  
  48. When writing small programs like this one, always use the standard C
  49. stdio library functions. If your code contains a lot of non-portable
  50. code (eg. GUI calls), then do use the faster dos.library functions. Your
  51. code isn't portable anyway.
  52.  
  53. -- 
  54. Jakob <orjarive@aftenposten.no>
  55.  
  56.  
  57.